package com.mc.tcp;

import java.io.IOException;
import java.net.InetSocketAddress;
import java.nio.ByteBuffer;
import java.nio.channels.SocketChannel;

public class ChannelClient {
	
	public void channelSocket(){
		try {
			SocketChannel sc = SocketChannel.open();
			sc.connect(new InetSocketAddress("localhost",10000));
			String str = "hello!";
			ByteBuffer bb = ByteBuffer.allocate(100);
			bb.put(str.getBytes());
			bb.flip();
			sc.write(bb);
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}
	public static void main(String[] args){
		ChannelClient cc = new ChannelClient();
		cc.channelSocket();
	}
}
